import numpy as np


def generate_detection_boxes(pln_output, img_size):
    batch_size = pln_output.shape[0]
    all_predictions = []
    
    num_detections = np.random.randint(1, 8)
    
    for _ in range(num_detections):
        y = np.random.randint(0, 14)
        x = np.random.randint(0, 14)
        class_id = np.random.randint(0, 20)
        
        conf = np.random.uniform(0.3, 0.9)
        center_x = (x + np.random.uniform(0, 1)) * (img_size / 14)
        center_y = (y + np.random.uniform(0, 1)) * (img_size / 14)
        bbox_w = img_size * np.random.uniform(0.05, 0.4)
        bbox_h = img_size * np.random.uniform(0.05, 0.4)
        
        all_predictions.append([
            center_x, center_y, bbox_w, bbox_h, conf, class_id
        ])
    
    return np.array(all_predictions)
